%tr.generic_commit_status
  %td.status
    - if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
      = ci_status_with_icon(generic_commit_status.status, generic_commit_status.target_url)
    - else
      = ci_status_with_icon(generic_commit_status.status)

  %td.generic_commit_status-link
    - if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
      = link_to generic_commit_status.target_url do
        %strong ##{generic_commit_status.id}
    - else
      %strong ##{generic_commit_status.id}

    - if defined?(retried) && retried
      = icon('warning', class: 'text-warning has-tooltip', title: '状态被重试。')

  - if defined?(commit_sha) && commit_sha
    %td
      = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "monospace"

  - if defined?(ref) && ref
    %td
      - if generic_commit_status.ref
        = link_to generic_commit_status.ref, namespace_project_commits_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.ref)
      - else
        .light 无

  - if defined?(runner) && runner
    %td
      - if generic_commit_status.try(:runner)
        = runner_link(generic_commit_status.runner)
      - else
        .light 无

  - if defined?(stage) && stage
    %td
      = generic_commit_status.stage

  %td
    = generic_commit_status.name

  %td
    - if generic_commit_status.tags.any?
      - generic_commit_status.tags.each do |tag|
        %span.label.label-primary
          = tag
    - if defined?(retried) && retried
      %span.label.label-warning 重试的

  %td.duration
    - if generic_commit_status.duration
      #{duration_in_words(generic_commit_status.finished_at, generic_commit_status.started_at)}

  %td.timestamp
    - if generic_commit_status.finished_at
      %span #{time_ago_with_tooltip(generic_commit_status.finished_at)}

  - if defined?(coverage) && coverage
    %td.coverage
      - if generic_commit_status.try(:coverage)
        #{generic_commit_status.coverage}%

  %td
